package com.settlement.system.service.impl;

import com.settlement.system.mapper.CompanyMapper;
import com.settlement.system.common.exception.ServiceException;
import com.settlement.system.model.entity.common.Company;
import com.settlement.system.service.ICompanyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import com.settlement.system.mapper.BaseMapper;
import jakarta.annotation.Resource;

/**
 * 结算公司信息表 服务实现类
 * @author Ximi
 * @since 2020-04-22
 */
@Service
@Slf4j
public class CompanyServiceImpl extends BaseServiceImpl implements ICompanyService {

    @Resource
    private CompanyMapper companyMapper;

    @Override
    public BaseMapper init() {
        return companyMapper;
    }

    /**
     * 根据店铺名称获取公司编码
     * @param shopNo 店铺编码
     * @return
     * @throws ServiceException
     */
    @Override
    public Company getCompanyByShopNo(String shopNo) throws ServiceException {
        try {
            return companyMapper.getCompanyByShopNo(shopNo);
        } catch (Exception ex){
            log.info("根据店铺名称获取公司编码异常",ex);
            throw  new ServiceException("根据店铺名称获取公司编码异常",ex);
        }
    }
}

